<template>
    <div class="page-b">
      <div class="item-content">      
        <Row>
          <Col class="item-title" span="3">原密码：</Col>
          <Col class="item-input" span="6">
              <Input v-validate="'required|email'" :class="{'input': true, 'is-danger': errors.has('email') }"  v-model="email" size="large" placeholder="Enter something..." ></Input>        
          </Col>
        </Row>
      </div>
      <div class="item-content">      
        <Row>
          <Col class="item-title" span="3">新密码：</Col>
          <Col class="item-input" span="6">
              <Input  v-model="name" size="large" placeholder="Enter something..." ></Input>
          </Col>
        </Row>
      </div>
      <div class="item-content">      
        <Row>
          <Col class="item-title" span="3">确认密码：</Col>
          <Col class="item-input" span="6">
              <Input  size="large" placeholder="Enter something..." ></Input>
          </Col>
        </Row>
      </div>    
      <div class="item-content">      
        <Row>        
          <Col class="item-input" offset="3" span="6">                
              <Button class="btn"  @click="validateForm" size="large" type="primary">提交</Button>
              <Button class="btn" size="large">重置</Button>
          </Col>
        </Row>
      </div>    
    </div>
</template>
<script>
export default {
   validator: null,
  data() {
    return {
      email: "",
      name: ""
    };
  },
  mounted () {
    var v = this.$validator;
    console.log(v);

      this.$Message.error('Fail!');
      this.$Message.warning('Fail!');      
  },
  methods: {
    validateForm() {
      this.$validator
        .validateAll({
          email: this.email
        })
        .then(result => {
          if (result) {
            // eslint-disable-next-line
            console.log("All is well");
            return;
          }
          // eslint-disable-next-line
          console.log("Oops!");
        });
    },
    clearErrors() {
      this.errors.clear();
    }
  }
};
</script>

<style scoped lang="less">
.page-b {
  padding: 30px 0 0 0;

  // 单列表单布局
  .item-content {
    margin: 0 0 20px 0;
    .item-title {
      text-align: right;
      line-height: 40px;
      display: -webkit-box;
      box-sizing: border-box;
      -webkit-box-align: center;
      -webkit-box-pack: end;
      padding: 0 30px 0 0;
    }
    .item-input {
      box-sizing: border-box;
      padding: 3px 0 0 0;
      height: 45px;
      .btn {
        margin: 0 20px 0 0;
      }
    }
  }
}
</style>
